FROM php:7.4.11-fpm

# COPY run.sh /run.sh
# RUN chmod a+x /run.sh
# CMD [ "sh", "/run.sh" ]

RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak \
    && echo 'deb http://mirrors.aliyun.com/debian/ buster main non-free contrib' > /etc/apt/sources.list \
    && echo 'deb http://mirrors.aliyun.com/debian-security buster/updates main' >> /etc/apt/sources.list \
    && echo 'deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib' >> /etc/apt/sources.list \
    && echo 'deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib' >> /etc/apt/sources.list \
    && apt-get update \
    && export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS" \
    && apt-get install --assume-yes apt-utils -y --no-install-recommends libfreetype6-dev libjpeg62-turbo-dev libpng-dev libmagickwand-dev libmcrypt-dev libmemcached-dev zlib1g-dev \
    && rm -rf /var/lib/apt/lists/* \
    && docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ \
    && docker-php-ext-install -j$(nproc) bcmath calendar exif gettext sockets dba mysqli pcntl pdo_mysql shmop sysvmsg sysvsem sysvshm gd \
    && pecl install imagick-3.4.4 mcrypt-1.0.3 memcached-3.1.5 redis-5.3.2 xdebug-2.9.8 swoole-4.5.5 \
    && docker-php-ext-enable imagick mcrypt memcached redis xdebug swoole \
    && docker-php-ext-configure opcache --enable-opcache && docker-php-ext-install opcache

# ENTRYPOINT [ "echo '59.110.143.176 soso.myzx.cn' >> /etc/hosts" ]
# CMD [ "/bin/sh", "-c", "/run.sh" ]
# ENTRYPOINT [ "/bin/bash", "/run.sh" ]

# FROM php:7.4.11-fpm-alpine
# 修改镜像源
# RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
#         # 安装依赖,核心扩展,pecl扩展,git,composer,npm工具
#     && apk update \
#     && apk add --no-cache --virtual .build-deps \
#         $PHPIZE_DEPS curl-dev imagemagick-dev \
#         libtool libxml2-dev libmcrypt-dev freetype-dev libjpeg-turbo-dev \
#         libpng-dev oniguruma-dev libzip-dev \
#     && apk add --no-cache curl git imagemagick mysql-client postgresql-libs \
#     && pecl install imagick mcrypt-1.0.3 redis \
#     # && docker-php-ext-enable mcrypt imagick \
# 	&& docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ \
#     && docker-php-ext-install -j"$(getconf _NPROCESSORS_ONLN)" iconv curl mbstring pdo pdo_mysql pcntl xml zip gd \    
#     # && pecl install -o -f redis \
#     && rm -rf /tmp/pear \
#     && docker-php-ext-enable mcrypt imagick redis

# RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
#         # 安装依赖,核心扩展,pecl扩展,git,composer,npm工具
#     && apk update \
#     && apk add --no-cache --virtual .build-deps \
#         $PHPIZE_DEPS curl-dev imagemagick-dev \
#         libtool libxml2-dev libmcrypt-dev freetype-dev \
#          oniguruma-dev \
#     # && apk add --no-cache curl git imagemagick mysql-client postgresql-libs \
#     && pecl install imagick mcrypt-1.0.3 redis \
#     # && docker-php-ext-enable mcrypt imagick \
# 	&& docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ \
#     && docker-php-ext-install -j"$(getconf _NPROCESSORS_ONLN)" iconv curl mbstring pdo pdo_mysql pcntl xml zip gd \    
#     # && pecl install -o -f redis \
#     && rm -rf /tmp/pear \
#     && docker-php-ext-enable mcrypt imagick redis \
#     && apk del --no-network .build-deps

# RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
#     && apk update \
#     && apk add --no-cache --virtual .build-deps \
#         $PHPIZE_DEPS imagemagick-dev \
#         libmcrypt-dev freetype-dev libjpeg-turbo-dev \
#         libpng-dev gettext-dev libmemcached-dev \
# 	&& docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ \
#     && docker-php-ext-install -j"$(getconf _NPROCESSORS_ONLN)" bcmath calendar exif gettext sockets dba mysqli pcntl pdo_mysql shmop sysvmsg sysvsem sysvshm gd \ 
#     && pecl install imagick-3.4.4 mcrypt-1.0.3 memcached-3.1.5 redis-5.3.2 xdebug-2.9.8 swoole-4.5.5 \
#     && rm -rf /tmp/pear \
#     && docker-php-ext-enable imagick mcrypt memcached redis xdebug swoole \
#     && docker-php-ext-configure opcache --enable-opcache && docker-php-ext-install opcache \
#     && apk del --no-network .build-deps
    
EXPOSE 9000

# 镜像信息
LABEL Auth="Kings" Version="20201023" Description="PHP7.4开发环境镜像"